-
Notifications
You must be signed in to change notification settings - Fork 94
Introduce a range-diff viewer for GitHub force-push #2149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I just pushed a bunch a small changes which should improve the visual clarity, by reducing the highlighting parts and re-using I also added before and after links to each files, improved the bookmarklet help and added a small explanation for the block markers. Feedback welcome of course. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work!
The minus/plus with red/green background is a bit distracting visually, what about just keeping the red/green bar without minus/plus? The background contrast is also a bit dim, I'd either make the background lighter or the font more visible/higher opacity/"more white".
For the record,
We can try, but not sure if people will understand what they mean without the +/-.
The background contrast of the page? Or the red/green colors? Were you in dark mode? In dark mode it's the same background and text color as for our GHA logs viewer. |
I probably was in dark mode, and yeah, I find the contrast to be not ideal on both pages. But it's not terrible, so definitely a non-blocking comment :) It seems to work well, feel free to merge! |
Would doing something aking to GitHub diff viewer where the whole line has a background color work better for you? |
Probably not, I like the current visualization, just wanted to remove the +/- in the very left column, in particular also because the +/- is duplicated on actually changed lines. |
Well, there is complexity, they are not always duplicated, we can have |
Hmm, I probably don't have experience with range-diff, that's quite confusing to me. I would simply expect to see a diff from the old push to the new push, while ignoring all the other crap that happened on master in the meantime. |
There isn't any crap left, a range-diff does a diff of diffs, as you would expect. It's nevertheless quite confusing the first time you read one, as we need to show what was added and removed on the first push vs what was added and removed on the second push. That's why there is those double markers, the first one indicates what has changed between the the first and second push, and the second marker indicates what was/is the change. |
If we really wanted to, we could show a normal diff though, right? Just render the old contents and the new contents and diff them, without regarding the fact that the first version was already a "diff". |
What you're describing is I think what GitHub does, it shows the diff of contents (instead of the diff of diffs), which shows a lot of unrelated changes. |
Ofc I meant doing a diff between just the relevant changes, not everything. |
Hum, I guess that could work. We could probably do it by removing the removed lines from the diffs (as well as stripping |
I'm not saying that it's better, just that I personally find it less confusing. I think the current range diff is fine. |
The advantage of range-diff is that it gives you the diff between the two push compared to master, while comparing the final relevant parts between each others only gives you the diff between the two push. Each one has his advantages and dis-advantages.
Then let's keep the range-diff for now. We can experiment later with your solution. |
This PR adds an emulated git range-diff viewer for use GitHub and force push.
It's a well known issue with GitHub compare UI that when a force-push changes the base commit that GitHub's compare page will show all changes from the old base to the new head, which includes enormous amount of unrelated changes.
git range-diff
solves that by diff showing the diff of the old and new revision, and since GitHub doesn't offer this capability we can do it ourselves.This new feature works by having a new HTML endpoint
/gh-range-diff/{owner}/{repo}/{basehead}
that takes the org, repo andbase..head
, which we then use to retrieve the old and new diff.Those two diffs are then compared against each other, the resulting differences are then shown to the user.